package com.yoomiito.app.adapter.my


import android.text.TextUtils
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yoomiito.app.R
import com.yoomiito.app.model.my.ApplyInfo
import com.yoomiito.app.utils.ImageLoader

class RemainAdapter : BaseQuickAdapter<ApplyInfo, BaseViewHolder>(R.layout.item_reamin) {

    override fun convert(helper: BaseViewHolder, item: ApplyInfo) {
        helper.setText(R.id.item_goods_order_id, "订单：" + item.id)
        val goodsPicIv = helper.getView<ImageView>(R.id.item_goods_order_pic)
        ImageLoader.getInstance()
            .into(goodsPicIv.context, item.image, goodsPicIv, R.drawable.goods_default)
        val goodsTitleTv = helper.getView<TextView>(R.id.item_goods_order_title)
        goodsTitleTv.text = "提现账号：" + item.accountNumber

        val mobile = helper.getView<TextView>(R.id.item_mobile)
        mobile.text = "提现方式：" + item.payMethodStr
        helper.setText(R.id.item_goods_order_status, item.statusStr)
        helper.setText(R.id.item_goods_order_date, item.ctime)
        helper.setText(R.id.item_goods_order_price, "¥" + item.money);
        helper.setText(R.id.item_remark, "")
        if (item.status == 1) {
            helper.setTextColor(
                R.id.item_goods_order_status,
                ContextCompat.getColor(mContext, R.color.color_blue)
            )
        } else if (item.status == 0) {
            helper.setTextColor(
                R.id.item_goods_order_status,
                ContextCompat.getColor(mContext, R.color.color_orange)
            )
        } else {
            if (!TextUtils.isEmpty(item.remarks))
                helper.setText(R.id.item_remark, "驳回理由:" + item.remarks);
            helper.setTextColor(
                R.id.item_goods_order_status,
                ContextCompat.getColor(mContext, R.color.color_F84545)
            )
        }


    }


}
